package com.ssau.expert.core.model;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: Sergey Saiyan
 * Created: 05.09.13 12:50
 */
public class Rule {

    protected String id;

    protected String ruleString;

    protected List<Condition> conditions;

    protected String ruleOutput;

    protected Variable outputVariable;

    public Rule() {
        conditions = new ArrayList<>();
    }

    public String getRuleString() {
        return ruleString;
    }

    public void setRuleString(String ruleString) {
        this.ruleString = ruleString;
    }

    public List<Condition> getConditions() {
        return conditions;
    }

    public void setConditions(List<Condition> conditions) {
        this.conditions = conditions;
    }

    public String getConditionsString() {
        StringBuilder sb = new StringBuilder();
        for (Condition condition : conditions) {
            sb.append(condition.getConditionString()).append(" && ");
        }
        sb.delete(sb.length() - 4, sb.length());
        return sb.toString();
    }


    public String getRuleOutput() {
        return ruleOutput;
    }

    public void setRuleOutput(String ruleOutput) {
        this.ruleOutput = ruleOutput;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Variable getOutputVariable() {
        return outputVariable;
    }

    public void setOutputVariable(Variable outputVariable) {
        this.outputVariable = outputVariable;
    }
}
